package cn.tk.model.pojo.mr.flow;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * Created by denglw on 2021/7/19.<br/>
 * Desc: 函数节点函数配置
 */
@Data @NoArgsConstructor
public class FuncNodeParameter {

    /**
     * 函数节点id
     */
    private Long nodeId;

    /**
     * 方法参数名
     */
    private String name;

    /**
     * 参数类型：1入参 2出参
     */
    private Integer paramType;

    /**
     * 关联类型：1变量 2实体
     */
    private Integer type;

    /**
     * 当type=1时，关联的变量id
     */
    private Long variableId;

    /**
     * 变量码
     */
    private String variableEnName;

    /**
     * 当type=2时，关联的实体id
     */
    private Long entityId;

    /**
     * 实体码
     */
    private String entityCode;

    public FuncNodeParameter(Long nodeId, String name, Integer paramType, Integer type, Long variableId, Long entityId) {
        this.nodeId = nodeId;
        this.name = name;
        this.paramType = paramType;
        this.type = type;
        this.variableId = variableId;
        this.entityId = entityId;
    }

    public boolean isVariableType() {
        return Objects.equals(type, 1);
    }

    public boolean isEntityType() {
        return Objects.equals(type, 2);
    }
}
